package com.example.project.dao.sqls;

import com.example.project.entity.User;
import org.apache.ibatis.jdbc.SQL;

public class UserProvider {
    public String findAllSql() {
        return new SQL()
                .SELECT("*")
                .FROM("user")
                .toString();
    }

    public String findByIdSql() {
        return new SQL()
                .SELECT("*")
                .FROM("user")
                .WHERE("id=#{id}")
                .toString();
    }

    public String findByNameSql() {
        return new SQL()
                .SELECT("*")
                .FROM("user")
                .WHERE("username=#{username}")
                .toString();
    }

    public String saveUserSql() {
        return new SQL()
                .INSERT_INTO("user")
                .VALUES("name,username,password,phone,sex,create_time,update_time",
                        "#{name},#{username},#{password},#{phone},#{sex},#{createTime},#{updateTime}")
                .toString();
    }
}
